package com.wangyg.flourfactory.outer;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
 * Created by wangyg6 on 2019/5/21 21:31.
 * 具体是返回create中的实现类，用两种方法实现，一个内部类，一个是创建好的bean。此处方式二
 */
@Slf4j
public class ICallFlourFactoryFactory implements FallbackFactory<ICallFlourFactory> {
	@Autowired
	@Qualifier("flourFactory2")
	ICallFlourFactory flourFactory2;

	@Override
	public ICallFlourFactory create(Throwable cause) {
		log.error(cause.getMessage());
		return flourFactory2;
	}
}
